package com.jalarbee.core.bootik.client.business;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import org.hibernate.annotations.Columns;
import org.hibernate.annotations.Type;

import com.jalarbee.core.bootik.bon.business.Bon;
import com.jalarbee.core.money.MonetaryAmount;
import com.jalarbee.core.user.business.User;

@Entity
@DiscriminatorValue(value = "C")
public class Client extends User {

    @Type(type = "com.jalarbee.core.money.MonetaryAmountType")
    @Columns(columns = {
        @Column(name = "CURRENCY"),
        @Column(name = "AMOUNT")
        })
    private MonetaryAmount bonCreditLimit;
    @OneToOne(fetch = FetchType.LAZY)
    private ClientStatistics statistics;
    @Enumerated(EnumType.STRING)
    private Solvability solvability;
    @OneToMany(mappedBy = "client")
    private List<Bon> bons;

    public MonetaryAmount getBonCreditLimit() {
        return bonCreditLimit;
    }

    public void setBonCreditLimit(MonetaryAmount bonCreditLimit) {
        this.bonCreditLimit = bonCreditLimit;
    }

    public ClientStatistics getStatistics() {
        return statistics;
    }

    public void setStatistics(ClientStatistics statistics) {
        this.statistics = statistics;
    }

    public Solvability getSolvability() {
        return solvability;
    }

    public void setSolvability(Solvability solvability) {
        this.solvability = solvability;
    }

    public List<Bon> getBons() {
        return bons;
    }

    public void setBons(List<Bon> bons) {
        this.bons = bons;
    }
}
